const agent = navigator.userAgent.toLowerCase()
const opera = window.opera
export const isOpera = () => {
  return !!opera && opera.version
}
export const isIE = () => {
  return /(msie\s|trident.*rv:)([\w.]+)/.test(agent)
}
export const isWebkit = () => {
  return agent.indexOf(' applewebkit/') > -1
}
export const isFirefox = () => {
  return agent.indexOf('firefox/') > -1
}
export const isChrome = () => {
  return agent.toLowerCase().indexOf('chrome/') > -1
}
export const isSafari = () => {
  return agent.indexOf('safari/') > -1 && agent.indexOf('chrome/') == -1
}
export const isIpad = () => {
  return agent.indexOf('iPad/') > -1
}
export const isMac = () => {
  return agent.indexOf('macintosh') > -1
}
export const isWeixin = () => {
  if (agent.match(/MicroMessenger/i) == 'micromessenger') {
    return true
  } else {
    return false
  }
}
